package com.example.shushiyunsst.fragment.main.home.child.icon_sst.bean;


import androidx.collection.ArrayMap;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import static com.example.library_common.utils.even.MessageKt.ICON_TRANSFER_NOTIFY;

public class PushMsgManager {

    private Map<String, List<PushMsgBean>> mPushMsgList = new ArrayMap();

    private PushMsgManager() {
        mPushMsgList.put(ICON_TRANSFER_NOTIFY, new ArrayList<>());
    }

    public final static class HolderClass {
        private static final PushMsgManager HOLDER = new PushMsgManager();
    }

    public static PushMsgManager getInstance() {
        return HolderClass.HOLDER;
    }



    public void addIconPushMsgList(PushMsgBean mPushMsgBean) {
        List<PushMsgBean> pushMsgBeans = mPushMsgList.get(ICON_TRANSFER_NOTIFY);
        if (pushMsgBeans == null) {
            pushMsgBeans = new ArrayList<>();
            mPushMsgList.put(ICON_TRANSFER_NOTIFY, pushMsgBeans);
        } else {
            pushMsgBeans.add(mPushMsgBean);
        }
        mPushMsgList.put(ICON_TRANSFER_NOTIFY, pushMsgBeans);
    }

    public void addIconPushMsgList( List<PushMsgBean> newPushMsgBeans) {
        List<PushMsgBean> pushMsgBeans = mPushMsgList.get(ICON_TRANSFER_NOTIFY);
        pushMsgBeans.clear();
        pushMsgBeans.addAll(newPushMsgBeans);
        mPushMsgList.put(ICON_TRANSFER_NOTIFY, pushMsgBeans);
    }

    public List<PushMsgBean> getIconPushMsgList() {
        List<PushMsgBean> pushMsgBeans = mPushMsgList.get(ICON_TRANSFER_NOTIFY);
        if (pushMsgBeans == null) {
            pushMsgBeans = new ArrayList<>();
            mPushMsgList.put(ICON_TRANSFER_NOTIFY, pushMsgBeans);
        }
        return pushMsgBeans;
    }
}
